<?php
    require_once ("Includes/session.php");
    require_once ("Includes/simplecms-config.php"); 
    require_once ("Includes/connectDB.php");
    require_once("conf.php");   
    include("Includes/header.php"); 
    if (!logged_on())
    {
        header ("Location: logon.php");
    }

?>

        <div id="add">
            <h2>Select Exam</h2>
            <p>Double click an exam to start</p>    
            <?php
            $dg = new C_DataGrid("SELECT * FROM exams", "id", "exams");
            $dg -> set_query_filter("ready = 1");
            $dg -> set_dimension(400, 300); 
            $dg -> set_col_hidden("id");
            $onSelectRow = <<<ONSELECTROW
            function(status, rowid)
            {
                window.location = "Student_DoExam.php?id=" + rowid;
	            //alert(rowid);
            }
ONSELECTROW;


                //$dg->add_event("jqGridSelectRow", $onSelectRow);
                $dg -> add_event("jqGridDblClickRow", $onSelectRow);
                $dg -> display();
            ?>
        </div>
</div>

<?php include ("Includes/footer.php"); ?>